import { reqCategoryList,reqGetBannerList,reqGetFloorList } from '@/api' 
export default {
	namespaced:true, //开启命名空间
	actions:{
		//通过API里面的函数接口调用，向服务器发送请求，获取服务器数据
		//获取三级菜单数据
		async categoryList(context){
			let result = await reqCategoryList(); 
			if(result.code == 200){
				context.commit('CATEGORYLIST',result.data);
			}
		},
		//获取首页轮播数据  
		async getBannerList(context){
		  let result = await reqGetBannerList();
		  if(result.code == 200){
			context.commit('GETBANNERLIST',result.data) 
		  } 
		},
		//获取floor数据
		async getFloorList(context){
			let result = await reqGetFloorList();
			if(result.code == 200){
			  context.commit('GETFLOORLIST',result.data) 
			} 
		  },	
	   	 
	},

	mutations:{
		CATEGORYLIST(state,categoryList){
			state.categoryList = categoryList;
	    },
		GETBANNERLIST(state,bannerList){
			state.bannerList = bannerList;
		},
		GETFLOORLIST(state,floorList){
          state.floorList = floorList;       
		}   
	},

	state:{ 
	    categoryList:[],//三级菜单数据
		bannerList:[], //轮播图数据  
		floorList:[]  //floor数据
	},

	getters:{
	  
	},

}